<?php echo $this->render($this->includeDir . '/toolbar.php');?>
<?php echo $this->flashMessage();?>
<?php 
	$arrParam = $this->arrParam;
	
	
	$site_name		= $this->formText('site_name',$this->Item['site_name'],array('class'=>'width-300 bg-green2 floatLeft' ));

	$logo			= $this->formFile('logo',array('class'=>'floatLeft' ));
	
	if($this->arrParam['action'] == 'edit'){
		$config = new Zendvn_Controller_Config(array('module'=>$arrParam['module'],
												'fileConfig'=>'site-config.ini'));
	 	$pictureConfig = $config->getConfig('item');
		$current_logo = '<div id="load-content-picture" class="clr width-150 center">';
		if(!empty($this->Item['logo'])){
			$logoUrl = $pictureConfig['thumbUrl'] . '/' . $this->Item['logo'];
			$removeLink = $this->url(array('action'=>'remove-pic','type'=>'picture','file'=>$this->Item['logo']));
			$current_logo .= '<br>' . $this->cmsImage('logo',$logoUrl,array('width'=>'75px'))
							. '<br><a  class="remove" href="javascript:loadPage(\'div#load-content-picture\',\'' . $removeLink . '\')">remove</a>';
		}
		$current_logo .= $this->formHidden('current_logo',$this->Item['logo'])
						. '</div>';
		$logo .=	$current_logo;		
	}
		

	$this->Item['html_description'] = Zendvn_Filter_Filter::filterContent($this->Item['html_description']);
	$html_description 	= $this->formTextarea('html_description',$this->Item['html_description'],array('class'=>'width-400','rows'=>8));
	$this->Item['html_keyword'] = Zendvn_Filter_Filter::filterContent($this->Item['html_keyword']);
	$html_keyword 	= $this->formTextarea('html_keyword',$this->Item['html_keyword'],array('class'=>'width-400','rows'=>8));
	
	
	/*==============================================
	 * Suport Area
	 *==============================================*/
	$yahoo		= $this->formTextarea('yahoo',$this->Item['yahoo'],array('class'=>'width-400','rows'=>3 ));
	$skype		= $this->formTextarea('skype',$this->Item['skype'],array('class'=>'width-400','rows'=>3 ));
	$phone		= $this->formTextarea('phone',$this->Item['phone'],array('class'=>'width-400','rows'=>3 ));
	
	/*==============================================
	 * Mail Area
	 *==============================================*/
	$mail_server	= $this->formText('mail_server',$this->Item['mail_server'],array('class'=>'width-300 bg-green2 floatLeft'));
	$mail_send		= $this->formText('mail_send',$this->Item['mail_send'],array('class'=>'width-300 bg-green2 floatLeft'));
	$mail_password	= $this->formText('mail_password',$this->Item['mail_password'],array('class'=>'width-300 bg-green2 floatLeft'));
	$mail_title		= $this->formText('mail_title',$this->Item['mail_title'],array('class'=>'width-300 bg-green2 floatLeft'));
	$mail_receive	= $this->formText('mail_receive',$this->Item['mail_receive'],array('class'=>'width-300 bg-green2 floatLeft'));
	
	/*==============================================
	 * Footer Area
	*==============================================*/
	$footer_content		= Zendvn_Filter_Filter::filterContent($this->Item['footer_content'],'filter');
	$footer_content		= $this->tinyMce('footer_content',$footer_content,array('style'=>"width: 100%; height: 350px;"));
	$footer_content		= '<div id="d_footer_content" style="width:98%; float: left">' . $footer_content . '</div>';
	
	$arrTooltip = array(
						'site_name'=>"Name of website.",
						'logo'=>"Logo of website.",
						'html_description'=>"Content of meta description for SEO",
						'html_keyword'=>"Content of meta keyword for SEO",
						'yahoo' => 'Add your yahoo|Separated by commas',
						'skype' => 'Add your skype|Separated by commas',
						'phone' => 'Add your phone|Separated by commas',
					);
	
	
						
	if(count($arrTooltip)>0){
		foreach ($arrTooltip as $key => $val){
			$attribs = array();
		   $formHelp  .= $this->cmsFormHelp('.form-table #' . $key, $this->translate($val), $attribs); 
		}
	}
	
	 if(count($this->errors)>0){	
	 	foreach ($this->errors as $key => $val){	 		
	 		$$key .= $this->cmsError($key,$val);	
	 		$selector = '.form-table #' . $key . '-error';
	 		$options = array('type'=>'error','name'=>'#' .$key);
	 		$formHelp  .= $this->cmsFormHelp($selector, $this->translate($val),null,$options);
	 		
	 	}
	 }
	 $arrRow = array(
					array('label'=>$this->translate('Site name'),'input'=>$site_name),	
					array('label'=>$this->translate('Logo'),'input'=>$logo),						
					array('label'=>$this->translate('Html descript'),'input'=>$html_description),
					array('label'=>$this->translate('Html keywords'),'input'=>$html_keyword),
					);
	$tdForm = $this->partialLoop('row.php',$arrRow);
	
	$arrRow = array(
			array('label'=>$this->translate('Yahoo'),'input'=>$yahoo),
			array('label'=>$this->translate('Skype'),'input'=>$skype),
			array('label'=>$this->translate('Phone'),'input'=>$phone),
	);
	$tdForm2 = $this->partialLoop('row.php',$arrRow);
	
	$arrRow = array(
			array('label'=>$this->translate('Mail server'),'input'=>$mail_server),
			array('label'=>$this->translate('Mail send'),'input'=>$mail_send),
			array('label'=>$this->translate('Mail password'),'input'=>$mail_password),
			array('label'=>$this->translate('Mail title'),'input'=>$mail_title),
			array('label'=>$this->translate('Mail receive'),'input'=>$mail_receive),
	);
	$tdForm3 = $this->partialLoop('row.php',$arrRow);
	
	$arrRow = array(
			array('label'=>$this->translate('Footer Content'),'input'=>$footer_content),
	);
	$tdForm4 = $this->partialLoop('row.php',$arrRow);
	
?>
<script type="text/javascript">
	$(document).ready(function() {
		<?php echo $formHelp;?>
	});
</script>
<div id="element-box">
	<div class="m">
		<div class="form-table">
        	<fieldset class="admin-fieldset">
                <legend class="admin-legend"><?php echo $this->translate('General Config')?></legend>
            	<table width="100%" border="0">
                	<?php echo $tdForm;?>
                </table>
                <div class="clr"></div>
        	</fieldset> 
        	<fieldset class="admin-fieldset">
                <legend class="admin-legend"><?php echo $this->translate('Support Config')?></legend>
            	<table width="100%" border="0">
                	<?php echo $tdForm2;?>
                </table>
                <div class="clr"></div>
        	</fieldset>  
        	<fieldset class="admin-fieldset">
                <legend class="admin-legend"><?php echo $this->translate('Mail Config')?></legend>
            	<table width="100%" border="0">
                	<?php echo $tdForm3;?>
                </table>
                <div class="clr"></div>
        	</fieldset>  
        	<fieldset class="admin-fieldset">
                <legend class="admin-legend"><?php echo $this->translate('Footer Content')?></legend>
            	<table width="100%" border="0">
                	<?php echo $tdForm4;?>
                </table>
                <div class="clr"></div>
        	</fieldset>  
        </div>
       
        <div class="clr"></div>
	</div>
</div>
